#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <sys/shm.h>

#include "D_LOG.h"

#include "fileinfo.h"


#define SERVER_IP   "127.0.0.1"
#define SERVER_PORT  12106
#define BUFFER_SIZE 65000
#define BUFFER_MAX  1 << 16

int main(int argc, char *argv[])
{


    while (1) {
        NetHandle server(SERVER_IP, SERVER_PORT);

        MMSG_OP *msg = new MMSG_OP(101, 888, *server);

        char str[1024];
        bzero(str, 1024);
        fgets(str, sizeof(str), stdin);

        str[strcspn(str, "\n")] = '\0';

        if (strcmp(str, "exit") == 0) {
            break;
        }

        msg->Send(str);

        MY_LOGD("info: %d", msg->GetState());
    }

    return 0;
}

void getCmdParams(char *str, char *path, char *name){
    char *index = strrchr(str, '\\');

    memcpy(path, str, index-str+1);
    strcpy(name, index+1);
}

